home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s1.arc / INITTERM.MOD < prev    next >
Text File  |  1987-09-08  |  5KB  |  104 lines

  1. (*----------------------------------------------------------------------*)
  2. (*                  InitTerm --- Initialize PibTerm                     *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE InitTerm;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  InitTerm                                             *)
  10. (*                                                                      *)
  11. (*     Purpose:    Initializes PibTerm                                  *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        InitTerm;                                                     *)
  16. (*                                                                      *)
  17. (*     Calls:                                                           *)
  18. (*                                                                      *)
  19. (*        INt24On                                                       *)
  20. (*        Set_Defaults                                                  *)
  21. (*        InitOvly                                                      *)
  22. (*        Read_Config_File                                              *)
  23. (*        MyLoadOverlay                                                 *)
  24. (*        TestVersionWarning                                            *)
  25. (*                                                                      *)
  26. (*----------------------------------------------------------------------*)
  27.  
  28. VAR
  29.    I : INTEGER;
  30.  
  31. BEGIN (* InitTerm *)
  32.                                    (* Initialize critical error *)
  33.                                    (* handler routine.          *)
  34.    Int24ON;
  35.                                    (* Initialize handler for    *)
  36.                                    (* other errors.             *)
  37.    ErrorPtr := OFS( Trap_Error );
  38.                                    (* Indicate that no modules *)
  39.                                    (* are currently loaded.    *)
  40.    FOR I := 1 TO MaxNumModules DO
  41.       ModuleLoaded[I] := -99;
  42.                                    (* Get config file directory             *)
  43.    InitOvly;
  44.                                    (* See if parameter reader can be loaded *)
  45.                                    (* And also parameter setter             *)
  46.  
  47.    IF ( ( NOT MyLoadOverlay( 0, PT4SETP, 'PT4SETP.CHN' ) ) OR
  48.         ( NOT MyLoadOverlay( 1, PT4INIT, 'PT4INIT.CHN' ) ) ) THEN
  49.       BEGIN
  50.          WRITELN('*** PibTerm cannot be initialized.');
  51.          WRITELN('*** Program stops.');
  52.          Halt( 1 );
  53.       END;
  54.                                    (* Display message if this is *)
  55.                                    (* a test version.            *)
  56.    IF Test_Version THEN
  57.       Test_Version_Warning;
  58.                                    (* Determine if multitasker active *)
  59.                                    (* Also sets 'Multitasker' telling *)
  60.                                    (* which multitasker is active     *)
  61.  
  62.    TimeSharingActive := IsTimeSharingActive;
  63.  
  64.                                    (* Redirect keyboard input to *)
  65.                                    (* PibTerm's special driver   *)
  66.    Keyboard_Buffer[0] := #0;
  67.    ConInPtr           := OFS( Keyboard_Reader );
  68.  
  69.                                    (* Get current interrupt 9 address *)
  70.  
  71.    DOS_Get_Intrpt( Kbd_Interrupt , Kbd_Save_Iaddr1, Kbd_Save_Iaddr2 );
  72.  
  73.                                    (* Get current interrupt $10 address *)
  74.  
  75.    DOS_Get_Intrpt( Video_Interrupt , Video_Save_Iaddr1, Video_Save_Iaddr2 );
  76.  
  77.                                    (* And initialize the global variables *)
  78.    Set_Defaults;
  79.                                    (* Read or create primary config. file *)
  80.  
  81.    IF ( NOT Read_Config_File ) THEN
  82.       BEGIN
  83.          Get_Default_Params( TRUE );
  84.          Write_Config_File('');
  85.       END;
  86.                                    (* Allocate dialing directory, *)
  87.                                    (* review buffer.              *)
  88.    Allocate_Dial_And_Review;
  89.                                    (* Read in directory, function keys, etc. *)
  90.    Get_Other_Files;
  91.                                    (* Ensure code segment variables updated  *)
  92.  
  93.    CloneCodeSegment( TurboRunDataStart , TurboRunDataLength );
  94.  
  95.                                    (* Set other parameters *)
  96.    Set_Other_Parameters;
  97.                                    (* Clear out command line area. *)
  98.    Mem[CSeg:$80] := 0;
  99.    Mem[CSeg:$81] := ORD( CR );
  100.                                    (* Initialize communications *)
  101.    Initialize_Communications;
  102.  
  103. END   (* InitTerm *);
  104.